home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amoszine 4
/
Amoszine 4 (Disk 2 of 3).adf
/
CELEBRITY_SOURCE
/
CELEB.lha
/
DpaintBox.AMOS
/
DpaintBox.amosSourceCode
< prev
next >
Wrap
AMOS Source Code
|
1992-02-26
|
6KB
|
197 lines
' Dpaint type option Box, by Paul Overy.
'
' The box has three top options, Quit, Move & Sleep which can also be
' clicked on with the mouse.
'
' The mouse will change shape when placed on box, ready for option selection.
'
' Bank 15 -> Packed picture of option box and new mouse pointers.
'
Proc CUT_SPRITES
Proc SET_UP
'
Do
'
If Sprite Col(0,4 To 4)
'
Sprite 1,,,1 : Rem Arrow pointer
'
If Mouse Key
'
' This line only needs to be called if the box has moved,
' Call this procedure only when needed if you have many
' options in your box.
_MAKE_ZONES[X Sprite(4),Y Sprite(4)]
'
' Relate mouse zone click to a procedure task.
On Mouse Zone Proc _QUIT,_DRAG,_SLEEP,_DRAW,_LINE,_FILL,_CUT,_SWAP,_BLOCKS,_ZOOM,_DIR,_UNDO,_CLR,_LOAD,_SAVE
End If
Else
Sprite 1,,,2 : Rem Crosshair Pointer
End If
'
Loop
'
Procedure _QUIT
Repeat : Until Mouse Key=0 or Mouse Zone<>1
If Mouse Zone=1
Stop
End If
End Proc
Procedure _DRAG
X_START=X Mouse : Y_START=Y Mouse
X_BOX=X Sprite(4) : Y_BOX=Y Sprite(4)
Sprite Off 2
Repeat
Amreg(4,0)=X Mouse-X_START+X_BOX
Amreg(4,1)=Y Mouse-Y_START+Y_BOX
Until Mouse Key=0
End Proc
Procedure _SLEEP
Repeat : Until Mouse Key=0 or Mouse Zone<>3
If Mouse Zone=3
Sprite Off 2
Sprite 4,,,9-I Sprite(4)
End If
End Proc
'
Procedure _DRAW
Sprite 2,X Sprite(4),Y Sprite(4)+9,6
Repeat : Until Mouse Key=0 or Mouse Zone<>4
End Proc
Procedure _LINE
Sprite 2,X Sprite(4)+12,Y Sprite(4)+9,6
Repeat : Until Mouse Key=0 or Mouse Zone<>5
End Proc
Procedure _FILL
Sprite 2,X Sprite(4),Y Sprite(4)+21,6
Repeat : Until Mouse Key=0 or Mouse Zone<>6
End Proc
Procedure _CUT
Sprite 2,X Sprite(4)+12,Y Sprite(4)+21,6
Repeat : Until Mouse Key=0 or Mouse Zone<>7
End Proc
Procedure _SWAP
Sprite 2,X Sprite(4),Y Sprite(4)+33,6
Repeat : Until Mouse Key=0 or Mouse Zone<>8
End Proc
Procedure _BLOCKS
Sprite 2,X Sprite(4)+12,Y Sprite(4)+33,6
Repeat : Until Mouse Key=0 or Mouse Zone<>9
End Proc
Procedure _ZOOM
Sprite 2,X Sprite(4),Y Sprite(4)+45,6
Repeat : Until Mouse Key=0 or Mouse Zone<>10
End Proc
Procedure _DIR
Sprite 2,X Sprite(4)+12,Y Sprite(4)+45,6
Repeat : Until Mouse Key=0 or Mouse Zone<>11
End Proc
Procedure _UNDO
Sprite 2,X Sprite(4),Y Sprite(4)+57,6
Repeat : Until Mouse Key=0 or Mouse Zone<>12
Sprite Off 2
End Proc
Procedure _CLR
Sprite 2,X Sprite(4)+12,Y Sprite(4)+57,6
Repeat : Until Mouse Key=0 or Mouse Zone<>13
Sprite Off 2
End Proc
Procedure _LOAD
Bell
End Proc
Procedure _SAVE
Boom
End Proc
'
Procedure _MAKE_ZONES[X1,Y1]
'
' I'm not to keen on having loops in critical parts of my code.
'
' NOTE: If you have the Easy life extension
' this procedure can be carried out in ONE LINE!
'
X=X Screen(X1)
Y=Y Screen(Y1)
'
' The top three zone options
Set Zone 1,X+1,Y+1 To X+4,Y+6 : Set Zone 2,X+7,Y To X+12,Y+7 : Set Zone 3,X+14,Y To X+22,Y+7
'
If I Sprite(4)<>5
'Main set of options
Set Zone 4,X,Y+9 To X+10,Y+19 : Set Zone 5,X+12,Y+9 To X+22,Y+19
Set Zone 6,X,Y+21 To X+10,Y+31 : Set Zone 7,X+12,Y+21 To X+22,Y+31
Set Zone 8,X,Y+33 To X+10,Y+43 : Set Zone 9,X+12,Y+33 To X+22,Y+43
Set Zone 10,X,Y+45 To X+10,Y+55 : Set Zone 11,X+12,Y+45 To X+22,Y+55
Set Zone 12,X,Y+57 To X+10,Y+67 : Set Zone 13,X+12,Y+57 To X+22,Y+67
' Save & load
Set Zone 14,X,Y+69 To X+22,Y+79 : Set Zone 15,X,Y+81 To X+22,Y+91
End If
'
End Proc
Procedure CUT_SPRITES
'
Bob Update Off : Autoback 0
Set Sprite Buffer 128 : Hide
'
Unpack 15 To 0
'
' Mouse pointer frames
Get Sprite 1,0,96 To 16,112
Get Sprite 2,16,96 To 32,112
Get Sprite 3,32,96 To 48,104
' Option Box & sleep option box
Get Sprite 4,0,0 To 32,96
Get Sprite 5,0,0 To 32,8
' Option selected shadow.
Get Sprite 6,48,96 To 64,112
'
Cls 0
Hot Spot 1,5,5 : Hot Spot 2,5,5 : Hot Spot 3,5,5
'
For K=0 To 3
For L=0 To 2
C=Colour(1+L)
Colour 4*K+L+17,C
Next L
Next K
'
Make Mask
'
End Proc
Procedure SET_UP
'
' New mouse routine.
MOUSE1$=" Loop: "
MOUSE1$=MOUSE1$+" Let X=XM; "
MOUSE1$=MOUSE1$+" Let Y=YM; "
MOUSE1$=MOUSE1$+" Pause "
MOUSE1$=MOUSE1$+" Jump Loop"
'
' Stops option box from leaving screen.
BX$=" Loop: "
BX$=BX$+" If R0<XH(0,0) then Jump A "
BX$=BX$+" If R0>XH(0,297) then Jump B "
BX$=BX$+" If R1<YH(0,0) then Jump C "
BX$=BX$+" If R1>YH(0,164) & A=4 then Jump D "
BX$=BX$+" If R1>YH(0,248) & A=5 then Jump E "
BX$=BX$+" Let X=R0; Let Y=R1; Pause "
BX$=BX$+" Jump Loop "
BX$=BX$+" A: Let R0=XH(0,0) "
BX$=BX$+" Jump Loop "
BX$=BX$+" B: Let R0=XH(0,297) "
BX$=BX$+" Jump Loop "
BX$=BX$+" C: Let R1=YH(0,0) "
BX$=BX$+" Jump Loop "
BX$=BX$+" D: Let R1=YH(0,164) "
BX$=BX$+" Jump Loop "
BX$=BX$+" E: Let R1=YH(0,248) "
BX$=BX$+" Jump Loop "
'
Sprite 0,0,0,3 : Sprite 1,200,100,1 : Sprite 4,0,0,4
Amal 0,MOUSE1$ : Amal 1,MOUSE1$ : Amal 4,BX$
Amal On
'
Limit Mouse : Amreg(4,0)=0 : Amreg(4,1)=0
Reserve Zone 16
End Proc